
import React, { forwardRef, Ref } from 'react'
import { useNavigate } from 'react-router-dom'
import styles from './index.module.less'
interface goodsType {
    id: string
    brandName: string
    pic: string
    price: number
}
const Goods = (props: any) => {
    // console.log(props.likelist);
    const goodsItems = props.likelist.map((item: goodsType) => {
        return (
            <div key={item.id} className={styles.goods_list} onClick={() => goodsDetail(item.id)}>
                <div className={styles.imgsbx}>
                    <img src={item.pic} alt="" />
                </div>
                <div className={styles.goods_text}>
                    <p>{item.brandName}</p>
                    <p className={styles.goods_price}>
                        <span>￥{item.price}元</span>
                        {props.type ? <span>不凡</span> : <span>乐居</span>}

                    </p>
                </div>


            </div>
        )
    })
    //点击事件
    const navegite = useNavigate()
    const goodsDetail = (val: string) => {
        navegite('/cate/goodsdetail?productId=' + val)

    }
    return (
        <div className={styles.content}>{goodsItems}
        </div>
    )
}
export default Goods
